<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="content-type">
  <title>Node</title>
</head>
<body style="font-family: Helvetica,Arial,sans-serif;">
<b>Simple Texture Shader</b><br><br>

Vertex Shader<br><br>

<code>
void main() { <br>
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;<br>
	vec3 N = normalize(gl_NormalMatrix * gl_Normal);<br>
	vec4 V = gl_ModelViewMatrix * gl_Vertex;<br>
	vec3 L = normalize(gl_LightSource[0].position.xyz - V.xyz);<br>
	vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));<br>

	const float specExp = 128.0;<br>

	float NdotL = max(0.0, dot(N, L));<br>
	vec4 diffuse = gl_Color * vec4(NdotL);<br>

	// specular lighting
	float NdotH = max(0.0, dot(N, H));<br>
	vec4 spec = vec4(0.0);<br>

	if(NdotL > 0.0) {<br>
		spec = vec4(pow(NdotH, specExp));<br>
	}<br>

	gl_FrontColor = diffuse + spec;<br>
}

</code>
<br>
<br>

Fragment Shader<br><br>

<code>
void main() {<br>
	float grey = dot(gl_Color.rgb, vec3(0.299, 0.587, 0.114));<br>
	gl_FragColor = vec4(grey * vec3(1.2, 1.0, 0.8), 1.0);<br>
}
</code>
<br>
<br>
</body>
</html>
